package com.xbao.dao;

import com.xbao.model.StuAccount;
import com.xbao.model.StuAccountExample;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface StuAccountMapper {
    @SelectProvider(type=StuAccountSqlProvider.class, method="countByExample")
    int countByExample(StuAccountExample example);

    @DeleteProvider(type=StuAccountSqlProvider.class, method="deleteByExample")
    int deleteByExample(StuAccountExample example);

    @Delete({
        "delete from stu_account",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into stu_account (id, sid, createtime, ",
        "updatetime, subid, ",
        "totalperiods, remainperiods, ",
        "starttime, endtime, ",
        "orgid)",
        "values (#{id,jdbcType=BIGINT}, #{sid,jdbcType=BIGINT}, #{createtime,jdbcType=BIGINT}, ",
        "#{updatetime,jdbcType=BIGINT}, #{subid,jdbcType=BIGINT}, ",
        "#{totalperiods,jdbcType=INTEGER}, #{remainperiods,jdbcType=INTEGER}, ",
        "#{starttime,jdbcType=BIGINT}, #{endtime,jdbcType=BIGINT}, ",
        "#{orgid,jdbcType=BIGINT})"
    })
    int insert(StuAccount record);

    @InsertProvider(type=StuAccountSqlProvider.class, method="insertSelective")
    int insertSelective(StuAccount record);

    @SelectProvider(type=StuAccountSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="totalperiods", property="totalperiods", jdbcType=JdbcType.INTEGER),
        @Result(column="remainperiods", property="remainperiods", jdbcType=JdbcType.INTEGER),
        @Result(column="starttime", property="starttime", jdbcType=JdbcType.BIGINT),
        @Result(column="endtime", property="endtime", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT)
    })
    List<StuAccount> selectByExample(StuAccountExample example);

    @Select({
        "select",
        "id, sid, createtime, updatetime, subid, totalperiods, remainperiods, starttime, ",
        "endtime, orgid",
        "from stu_account",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="totalperiods", property="totalperiods", jdbcType=JdbcType.INTEGER),
        @Result(column="remainperiods", property="remainperiods", jdbcType=JdbcType.INTEGER),
        @Result(column="starttime", property="starttime", jdbcType=JdbcType.BIGINT),
        @Result(column="endtime", property="endtime", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT)
    })
    StuAccount selectByPrimaryKey(Long id);

    @UpdateProvider(type=StuAccountSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") StuAccount record, @Param("example") StuAccountExample example);

    @UpdateProvider(type=StuAccountSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") StuAccount record, @Param("example") StuAccountExample example);

    @UpdateProvider(type=StuAccountSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(StuAccount record);

    @Update({
        "update stu_account",
        "set sid = #{sid,jdbcType=BIGINT},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "updatetime = #{updatetime,jdbcType=BIGINT},",
          "subid = #{subid,jdbcType=BIGINT},",
          "totalperiods = #{totalperiods,jdbcType=INTEGER},",
          "remainperiods = #{remainperiods,jdbcType=INTEGER},",
          "starttime = #{starttime,jdbcType=BIGINT},",
          "endtime = #{endtime,jdbcType=BIGINT},",
          "orgid = #{orgid,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(StuAccount record);
}